Tag Link | [File->Write] | Category | File |
---|---|---|---|
Type | Member | Source Available | Yes |
Support | Preferred | Version | 7.0 |
Change | Unchanged | Data Source | Any |
Output Type | None | Security | File |
Implementation | LCAPI | Sets | Lasso 8.5, Lasso 8.0, Lasso 7.0 |
Writes string data to a file. Requires the text string to write as a parameter. Two optional comma
[File Variable->(Write: 'This is some text')]
[File Variable->(Write: 'This is some text', Integer, Integer)]
Required Parameters | |
---|---|
'String' | String value to write to the file. |
To write text to a file:
Use the [File->Write] tag. The file object should be cast with an open mode that permits writing. The example below adds the text This is some text after the fifth line of the file.
[Var:'File'=(File: 'myfile.txt', File_OpenWrite, File_ModeLine)]
[$File->(SetPosition: 5)]
[$File->(Write:'this is some text')]
[$File->Close]
To write part of a string variable to a file:
Use the [File->Write] tag with the optional size and offset integer parameters. This is useful for truncating part of an existing string variable on
[Var:'Text'='There are five elements']
[Var:'File'=(File: 'myfile.txt', File_OpenWrite, File_ModeLine)]
[$File->(Write: $Text, 4, 10)]
[$File->Close]
Substitution | ||
---|---|---|
|
|
|